package com.boyi.shared.http.base;

import java.util.Properties;

import com.boyi.shared.util.GsonUtil;
import org.springframework.util.StringUtils;


public class BaseRequest implements IRequest {

    /**
     * API的名称
     * (Required)
     * 
     */
    private String API_NAME = "";
    /**
     * system
     * (Required)
     * 
     */
    private Object system;
    
    transient private Properties systemMap = new Properties();
    /**
     * callBackData
     * 
     */
    private Object callBackData;
    /**
     * params
     * (Required)
     * 
     */
    private Object params;
    
    transient private Properties paramsMap = new Properties();

    public BaseRequest(String apiName) {
        API_NAME = apiName; 
    }
    
    public void putSystem(String key, String value) {
        if (StringUtils.isEmpty(key) || StringUtils.isEmpty(value)) {
            return;
        }
        systemMap.put(key, value);
    }

    public void putParams(String key, String value) {
        if (StringUtils.isEmpty(key) || StringUtils.isEmpty(value)) {
            return;
        }
        paramsMap.put(key, value);
    }
    
    public void buildSystemAndParams() {
        system = GsonUtil.toJson(systemMap);
        params = GsonUtil.toJson(paramsMap);
    }
    
    /**
     * API的名称
     * (Required)
     * 
     */
    public String getAPI_NAME() {
        return API_NAME;
    }

    /**
     * API的名称
     * (Required)
     * 
     */
    public void setAPI_NAME(String API_NAME) {
        this.API_NAME = API_NAME;
    }

    /**
     * system
     * (Required)
     * 
     */
    public Object getSystem() {
        return system;
    }

    /**
     * system
     * (Required)
     * 
     */
    public void setSystem(Object system) {
        this.system = system;
    }

    /**
     * callBackData
     * 
     */
    public Object getCallBackData() {
        return callBackData;
    }

    /**
     * callBackData
     * 
     */
    public void setCallBackData(Object callBackData) {
        this.callBackData = callBackData;
    }

    /**
     * params
     * (Required)
     * 
     */
    public Object getParams() {
        return params;
    }

    /**
     * params
     * (Required)
     * 
     */
    public void setParams(Object params) {
        this.params = params;
    }
}
